package cn.yh.nft.turbo.auth.vo;

import cn.dev33.satoken.stp.StpUtil;
import cn.yh.nft.turbo.api.user.response.data.UserInfo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @ClassName: LoginVO
 * @Author: 草莓爱上啵啵
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
public class LoginVO implements Serializable {
    private static final long serialVersionUID = 1L;

    private String userId;

    private String token;

    private Long tokenExpiration;

    public LoginVO(UserInfo userInfo){
        this.userId = userInfo.getUserId().toString();
        this.token = StpUtil.getTokenValue();
        this.tokenExpiration = StpUtil.getTokenSessionTimeout();
    }
}
